var loc = document.location.href.toLowerCase();
//alert(loc);
var isRefer = loc.indexOf(".kao100.com");
var locTmp = loc.replace("http://", "");

if ((isRefer > 0) || ((locTmp.split("/").length == 6) && (locTmp.split("/")[0] == "www.kaoyee.com"))) {
    if ((loc == "http://www.kao100.com/") || (loc == "http://www.kao100.com/srcindex.aspx")) {
        loc = "http://www.kaoyee.com/";
    }
    else if ((loc == "http://train.kao100.com/") || (loc == "http://www.kao100.com/train/") || (loc == "http://www.kao100.com/train/default.aspx") || (loc.indexOf("train.kao100.com/")>0)) {
        loc = "http://ms.kaoyee.com/cula/index.rails";
    }
    else if ((loc == "http://chengkao.kao100.com/chengkao/default.aspx") || (loc == "http://chengkao.kao100.com/chengkao/") || (loc == "http://www.kao100.com/chengkao/default.aspx") || (loc == "http://www.kao100.com/chengkao/") || (loc == "http://chengkao.kao100.com/")) {
        loc = "http://ck.kaoyee.com/";
    }
    else if ((loc == "http://kaoyan.kao100.com/kaoyan/default.aspx") || (loc == "http://kaoyan.kao100.com/kaoyan/") || (loc == "http://www.kao100.com/kaoyan/default.aspx") || (loc == "http://www.kao100.com/kaoyan/") || (loc == "http://kaoyan.kao100.com/")) {
        loc = "http://ky.kaoyee.com/";
    }
    else if ((loc == "http://fashuo.kao100.com/fashuo/default.aspx") || (loc == "http://fashuo.kao100.com/fashuo/") || (loc == "http://www.kao100.com/fashuo/default.aspx") || (loc == "http://www.kao100.com/fashuo/") || (loc == "http://fashuo.kao100.com/")) {
        loc = "http://fs.kaoyee.com/";
    }
    else if ((loc == "http://sifa.kao100.com/sifa/default.aspx") || (loc == "http://sifa.kao100.com/sifa/") || (loc == "http://www.kao100.com/sifa/default.aspx") || (loc == "http://www.kao100.com/sifa/") || (loc == "http://sifa.kao100.com/")) {
        loc = "http://sf.kaoyee.com/";
    }
    else if ((loc == "http://kuaiji.kao100.com/kuaiji/default.aspx") || (loc == "http://kuaiji.kao100.com/kuaiji/") || (loc == "http://www.kao100.com/kuaiji/default.aspx") || (loc == "http://www.kao100.com/kuaiji/") || (loc == "http://kuaiji.kao100.com/")) {
        loc = "http://kj.kaoyee.com/";
    }
    else if ((loc == "http://gct.kao100.com/gct/default.aspx") || (loc == "http://gct.kao100.com/gct/") || (loc == "http://www.kao100.com/gct/default.aspx") || (loc == "http://www.kao100.com/gct/") || (loc == "http://gct.kao100.com/")) {
        loc = "http://gct.kaoyee.com/";
    }
    else if ((loc == "http://mba.kao100.com/mba/default.aspx") || (loc == "http://mba.kao100.com/mba/") || (loc == "http://www.kao100.com/mba/default.aspx") || (loc == "http://www.kao100.com/mba/") || (loc == "http://mba.kao100.com/")) {
        loc = "http://mba.kaoyee.com/";
    }
    else if ((loc == "http://cpa.kao100.com/cpa/default.aspx") || (loc == "http://cpa.kao100.com/cpa/") || (loc == "http://www.kao100.com/cpa/default.aspx") || (loc == "http://www.kao100.com/cpa/") || (loc == "http://cpa.kao100.com/")) {
        loc = "http://cpa.kaoyee.com/";
    }

    loc = loc.replace("http://chengkao.", "http://ck.");
    loc = loc.replace("http://kaoyan.", "http://ky.");
    loc = loc.replace("http://fashuo.", "http://fs.");
    loc = loc.replace("http://sifa.", "http://sf.");
    loc = loc.replace("http://kuaiji.", "http://kj.");

    loc = loc.replace(".kao100.com", ".kaoyee.com");

    var locTemp = loc.replace("http://", "");
    var locArr = locTemp.split("/");
    if ((locArr.length == 6) && locArr[0] == "www.kaoyee.com") {
        switch (locArr[2]) {
            case "chengkao":
                locArr[0] = locArr[0].replace("www", "ck");
                break;
            case "gct":
                locArr[0] = locArr[0].replace("www", "gct");
                break;
            case "mba":
                locArr[0] = locArr[0].replace("www", "mba");
                break;
            case "kaoyan":
                locArr[0] = locArr[0].replace("www", "ky");
                break;
            case "fashuo":
                locArr[0] = locArr[0].replace("www", "fs");
                break;
            case "art":
                locArr[0] = locArr[0].replace("www", "ys");
                break;
            case "educate":
                locArr[0] = locArr[0].replace("www", "js");
                break;

            case "kuaiji":
                locArr[0] = locArr[0].replace("www", "kj");
                break;
            case "cpa":
                locArr[0] = locArr[0].replace("www", "cpa");
                break;
            case "econ":
                locArr[0] = locArr[0].replace("www", "jjs");
                break;
            case "taxacc":
                locArr[0] = locArr[0].replace("www", "sws");
                break;
            case "eval":
                locArr[0] = locArr[0].replace("www", "pgs");
                break;
            case "bank":
                locArr[0] = locArr[0].replace("www", "yh");
                break;
            case "sacc":
                locArr[0] = locArr[0].replace("www", "zq");
                break;

            case "offi":
                locArr[0] = locArr[0].replace("www", "gwy");
                break;
            case "decl":
                locArr[0] = locArr[0].replace("www", "bgy");
                break;
            case "tour":
                locArr[0] = locArr[0].replace("www", "dyy");
                break;
            case "sifa":
                locArr[0] = locArr[0].replace("www", "sf");
                break;
            case "huma":
                locArr[0] = locArr[0].replace("www", "hr");
                break;
            case "exam":
                locArr[0] = locArr[0].replace("www", "wl");
                break;
            case "mentality":
                locArr[0] = locArr[0].replace("www", "xl");
                break;
            case "english":
                locArr[0] = locArr[0].replace("www", "english");
                break;

            case "buil":
                locArr[0] = locArr[0].replace("www", "yj");
                break;
            case "adju":
                locArr[0] = locArr[0].replace("www", "ej");
                break;
            case "fabr":
                locArr[0] = locArr[0].replace("www", "zjs");
                break;
            case "supe":
                locArr[0] = locArr[0].replace("www", "jls");
                break;
            case "safe":
                locArr[0] = locArr[0].replace("www", "aqs");
                break;
            case "advi":
                locArr[0] = locArr[0].replace("www", "zxs");
                break;
            case "arch":
                locArr[0] = locArr[0].replace("www", "zls");
                break;
            default:
                break;
        }
        loc = "http://" + locArr.join("/");
    }

    //alert(loc);
    document.location.href = loc;
}
else if ((loc == "http://kao100.com/train/default.aspx") || (loc == "http://kao100.com/train/")) {
    document.location.href = "http://ms.kaoyee.com/cula/index.rails";
}
else if ((loc == "http://kaoyee.com/") || (loc == "http://kao100.com/")) {
    document.location.href = "http://www.kaoyee.com/";
}
else if (loc.indexOf("kao100.com/about/") > 0) {
    document.location.href = loc.replace("http://kao100.com/","http://www.kaoyee.com/").replace("kao100.com/about/", "kaoyee.com/about/");
}